package com.googlecode.hypersphere.ws2ejb3.oaw.workflow;

import java.io.File;

import org.dom4j.DocumentException;
import org.openarchitectureware.workflow.WorkflowComponent;
import org.openarchitectureware.workflow.WorkflowContext;
import org.openarchitectureware.workflow.ast.parser.Location;
import org.openarchitectureware.workflow.container.CompositeComponent;
import org.openarchitectureware.workflow.issues.Issues;
import org.openarchitectureware.workflow.monitor.ProgressMonitor;

import com.googlecode.hypersphere.ejbJarXmlTransformer.EjbJarXmlTransformer;

public class EjbJarXmlTransformerWorkflowComponent implements WorkflowComponent {

	String ejbJarXmlPath = "";

	public void checkConfiguration(Issues issues) {
		// TODO Auto-generated method stub

	}

	public CompositeComponent getContainer() {
		// TODO Auto-generated method stub
		return null;
	}

	public Location getLocation() {
		// TODO Auto-generated method stub
		return null;
	}

	public void invoke(WorkflowContext ctx, ProgressMonitor monitor,
			Issues issues) {
		File file = new File(ejbJarXmlPath);
		EjbJarXmlTransformer transformer = new EjbJarXmlTransformer();
		try {
			transformer.transformXML(file, file.getParent()
					+ "/ejb-jar.ecore_compatible.xml");
		} catch (DocumentException e) {
			throw new IllegalStateException(e);
		}
	}

	public void setContainer(CompositeComponent container) {
		// TODO Auto-generated method stub

	}

	public void setLocation(Location location) {
		// TODO Auto-generated method stub

	}

	public String getEjbJarXmlPath() {
		return ejbJarXmlPath;
	}

	public void setEjbJarXmlPath(String ejbJarXmlPath) {
		this.ejbJarXmlPath = ejbJarXmlPath;
	}

}
